var DOMAIN_PATH = "http://service.motitravel.com/admin/";

var PAGE_API = {
	"LOGIN" : "login.html",
	"INDEX" : "index.html"
};

var INTERFACE_API = {
	//登录
	"LOGIN" : "login",
    //获取景区列表&创建景区
    "REGIONS" : "regions",
	//单个景区接口
	"REGIONDETAIL" : "regions/:region_id",
	//创建景点
	"SPOTS" : "regions/:region_id/spots",
	//单个景点接口
	"SPOTDETAIL" : "regions/:region_id/spots/:spot_id",
	//获取订单列表
	"ORDERS" : "orders",
	//出票
	"ADDTICKET" : "orders/:order_id/addticket",
	//退票
	"CANCEL" : "orders/:order_id/cancel",
	//导出订单表格
	"EXPORT" : "orders.csv",
	//获取批量出票信息
	"BATCHINFO" : "orders/:order_id/addticket_batch_info",
	//获取检票员列表
	"INSPECTORS" : "inspectors",
	//获取管理员列表
	"ADMINS" : "admins",
	//获取景区路线
	"LINES" : "regions/:region_id/lines",
	//上传图片
	"UPLOADIMAGE" : DOMAIN_PATH + "uploadImage",
	//上传音频
	"UPLOADAUDIO" : DOMAIN_PATH + "audio_v2",
	//七牛UPTOKEN获取
	"UPTOKEN": DOMAIN_PATH + "qiniu/upload_token"
};

//七牛UPTOKEN获取，每10min定时获取一次
var QINIU = {
	UP_TOKEN: null
};

var fetchUptokenHandler = function() {
	$.ajax({
		type: "get",
		url: INTERFACE_API.UPTOKEN,
        headers: {
            "Authorization" : "Bearer " + localStorage.getItem("U_INFO")
        },
        success: function(result) {
			QINIU.UP_TOKEN = result.upToken;
		}
    });
};

fetchUptokenHandler();
setInterval(fetchUptokenHandler, 10 * 60 * 1000);	